<template>
  <div class="table-box">
    <Table ref="tableRef" row-key="processInstanceId" :columns="columns" :request-api="camundaApi.applyList">
      <!-- 菜单操作 -->
      <template #action="{ row, id }">
        <TableAction :actions="getActions(row, id)"></TableAction>
      </template>
    </Table>
  </div>
</template>

<script setup lang="tsx" name="MicroTaskApply">
import { ref } from "vue";
import { Table, TableAction } from "@/components/Table";
import { ActionItem } from "@/components/Table/type";
import camundaApi from "@/views/micro/api/camunda.api";
import { columns } from "./data";
import { useRouter } from "vue-router";
const tableRef = ref();
const router = useRouter();
const getActions = (row, id): Partial<ActionItem>[] => {
  return [
    {
      type: "primary",
      label: "详情",
      onClick: () => {
        router.push({ path: "/micro/render/instance", query: { processInstanceId: id, title: row.processName } });
      }
    }
  ];
};
</script>
